package com.cai.controller;

import com.cai.bean.User;
import com.cai.commons.utils.SecurityMD5;
import com.cai.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class LoginController {
    @Autowired
    User USER;
    @Autowired
    LoginService loginService;
    /**
     *@Author  cwx
     *@Date 17-9-17 上午11:53
     *
     */
    @RequestMapping("/")
    public String index(){
        return "index";
    }
 /**
  *@Author  cwx
  *@Date 17-9-17 上午10:58
  *用户登录
  */
    @RequestMapping
    public String login(User user){
        return null;
    }

    /**
     *@Author  cwx
     *@Date 17-9-17 上午10:59
     *用户注册
     */
    @RequestMapping("/f")
    public String eroll(User user){
        user.setUserpwd(SecurityMD5.passwordToMD5(user.getUserpwd()));
        return null;
    }
    /**
     *@Author  cwx
     *@Date 17-9-17 上午11:00
     *admin用户注册
     */
    @RequestMapping("/autoEorll")
    public String autoEroll(User user){
    loginService.autoeroll(user);
    return "success";
    }
}
